/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Carito
 */
@Entity
@Table(name = "BOLETIN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Boletin.findAll", query = "SELECT b FROM Boletin b"),
    @NamedQuery(name = "Boletin.findByIdboletin", query = "SELECT b FROM Boletin b WHERE b.boletinPK.idboletin = :idboletin"),
    @NamedQuery(name = "Boletin.findByNombre", query = "SELECT b FROM Boletin b WHERE b.nombre = :nombre"),
    @NamedQuery(name = "Boletin.findByActividad", query = "SELECT b FROM Boletin b WHERE b.actividad = :actividad"),
    @NamedQuery(name = "Boletin.findByLocalizacion", query = "SELECT b FROM Boletin b WHERE b.localizacion = :localizacion"),
    @NamedQuery(name = "Boletin.findByTiempo", query = "SELECT b FROM Boletin b WHERE b.tiempo = :tiempo"),
    @NamedQuery(name = "Boletin.findByIddato", query = "SELECT b FROM Boletin b WHERE b.boletinPK.iddato = :iddato")})
public class Boletin implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BoletinPK boletinPK;
    @Size(max = 150)
    @Column(name = "NOMBRE")
    private String nombre;
    @Size(max = 150)
    @Column(name = "ACTIVIDAD")
    private String actividad;
    @Size(max = 150)
    @Column(name = "LOCALIZACION")
    private String localizacion;
    @Size(max = 150)
    @Column(name = "TIEMPO")
    private String tiempo;
    @JoinColumn(name = "IDDATO", referencedColumnName = "IDDATO", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Dato dato;

    public Boletin() {
    }

    public Boletin(BoletinPK boletinPK) {
        this.boletinPK = boletinPK;
    }

    public Boletin(BigInteger idboletin, BigInteger iddato) {
        this.boletinPK = new BoletinPK(idboletin, iddato);
    }

    @XmlElement
    public BoletinPK getBoletinPK() {
        return boletinPK;
    }

    public void setBoletinPK(BoletinPK boletinPK) {
        this.boletinPK = boletinPK;
    }

    @XmlElement
    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlElement
    public String getActividad() {
        return actividad;
    }

    public void setActividad(String actividad) {
        this.actividad = actividad;
    }

    @XmlElement
    public String getLocalizacion() {
        return localizacion;
    }

    public void setLocalizacion(String localizacion) {
        this.localizacion = localizacion;
    }

    @XmlElement
    public String getTiempo() {
        return tiempo;
    }

    public void setTiempo(String tiempo) {
        this.tiempo = tiempo;
    }

    @XmlElement
    public Dato getDato() {
        return dato;
    }

    public void setDato(Dato dato) {
        this.dato = dato;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (boletinPK != null ? boletinPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Boletin)) {
            return false;
        }
        Boletin other = (Boletin) object;
        if ((this.boletinPK == null && other.boletinPK != null) || (this.boletinPK != null && !this.boletinPK.equals(other.boletinPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Boletin[ boletinPK=" + boletinPK + " ]";
    }
    
}
